package net.alteiar.algorithms.builder;

import net.alteiar.images.metadata.ImageInfo;
import weka.core.Instance;

public class SpecificPointBuilder implements InstanceBuilder {

	private final int value;

	public SpecificPointBuilder(int value) {
		this.value = value;
	}

	@Override
	public Instance createInstance(ImageInfo info, int x, int y) {
		if (value == info.getValue(x, y)) {
			return new Instance(1.0, new double[] { x, y });
		}
		return null;
	}

	private static String[] ATTRIBUTS = new String[] { "x", "y" };

	@Override
	public String[] getAttributs() {
		return ATTRIBUTS;
	}

}
